package com.thinkit.bigdata.web.thread;

import com.thinkit.bigdata.web.model.bus.BusVoiceDetails;
import org.apache.log4j.Logger;

import java.util.concurrent.BlockingQueue;

/**
 * 生产者线程
 *
 * @author shijiakai
 */
public class Producer implements Runnable {

    private static Logger logger = Logger.getLogger(Producer.class);

    private BlockingQueue queue;//阻塞队列

    private BusVoiceDetails details;

    //构造函数
    public Producer(BlockingQueue queue, BusVoiceDetails details) {
        this.queue = queue;
        this.details = details;
    }

    public void run() {
        String VOICE_LOG_MES = "【异步导出数据任务】";
        logger.info(VOICE_LOG_MES + "启动生产者线程！");
        logger.info(VOICE_LOG_MES + "任务 = " + details.toString());
        queue.add(details);
        logger.info(VOICE_LOG_MES + "退出生产者线程！");
    }
}
